/*
 * Copyright 2009-2012 Evun Technology. 
 * 
 * This software is the confidential and proprietary information of
 * Evun Technology. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with evun.cn.
 */
package com.imis.demo.thread;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.imis.demo.springboot.config.SpringContextHolder;
import com.imis.demo.utils.uuid.DistributedUuidService;

/**
 *
 *
 * @author  WeiFei.Shu
 * @since 2018年7月19日 下午3:00:06
 *   
 */
@SuppressWarnings("unchecked")
public class UuidThread implements Runnable{
	@SuppressWarnings("rawtypes")
	private static Map uuidMap = new HashMap<Long,Long>();
	private static Logger LOG = LoggerFactory.getLogger(UuidThread.class);
	@Override
	public void run() {
		DistributedUuidService uuidService = SpringContextHolder.getBean(DistributedUuidService.class);
		long uuid = uuidService.generate();
		if(uuidMap.containsKey(uuid)){
			LOG.error("uuid【{}】 已存在！", uuid);
		}
		else{
			uuidMap.put(uuid, uuid);
		}
		LOG.info("uuid = {},  id总数：{}", uuid,uuidMap.size());
	}

}
